<!DOCTYPE html>
<html>
  <head>
    <title>Test Report</title>
    <meta charset="UTF-8">
    <style>body {    
    font-family: consolas, Verdana, sans-serif;
    font-size: .95em;
    color: #696e71;
    display: grid;
    grid-template-columns: 1fr 5rem;
}

.main_section {   
    width: 90%;
    margin: 0 auto;
}

#float_menu{    
    position:fixed;
    top:0;
    right:0;
    text-align: center;
}

#float_menu .menu-item {       
    cursor: pointer;
    padding: .5em;
    margin: .5em 0;
    color: #c08580;
    background-color: #f8f0ef;
    font-size: 1.2em;
}



.result{  
    display: flex;
}
  
  
.result_table{
    border-collapse: collapse;
    border: 1px solid #f0e0e5;
    width: 30em;
    text-align: center;
    font-size: 1.0em;
}
      
.result_table td{
    border: 1px solid #f0e0e5;
    padding: .3em;
}
  
.result_barchart{  
    width: 30em;
    margin: 0 5em 0 5em;
}
  
.barchar_item{
    margin: 2em 0;
}
  
.barchart_barbox {
    margin: 0.5em 0;
    width: 100%;
    background-color: #fff;
    border: 1px solid #86c2dd;
    border-radius: .2em;
}
  
.barchart_bar {
    text-align: right;
    color: white;
}
  
  



.h3_button {
    margin: 1.5em;
    cursor: pointer;
    color: #03a9f4;
}


.info
{
    white-space:pre-wrap;
    padding: .6em;
}


.error-info
{
    color: #a64747
}

.suite_dir {
    margin: 1em .2em;
    padding: .3em;
    /* background-color: #dfeff6; */
    border: 1px solid #bcd8e4;
}
.suite_file {
    margin: 1em .2em;
    padding: .3em;
    border: 1px solid #bcd8e4;
}


.case {
    margin: 1em .2em;
    /* padding: .3em; */
    border: 1px solid #e7d4d4;
}

.case_class_path{
    margin: 0em 1em; 
}


.folder_header { 
    padding: .2em .7em;
    background-color: #fffaf9;
    cursor: pointer;
}


.setup{
    margin: .2em;
    /* padding: .3em; */
    /* border: 1px solid #e7d4d4; */
}
.teardown{
    margin: .2em;
    /* padding: .3em;*/
    /* border: 1px solid #e7d4d4; */
}
.test_steps{
    margin: .2em;
    padding: .3em;
    /* border: 1px solid #e7d4d4; */
}


.label {
    display: inline-block;
    padding: .1em .5em;
    font-size: .88em;
    letter-spacing: 1px;
    white-space: nowrap;
    color: #0d6ebc;
    border-radius: .2em;
    min-width: 5em;    
    margin-right: 2em;
    font-family: consolas;
}

/* .suite_setup .label{
    color: #219e26 ;
}
.suite_teardown .label{
    color: #219e26;
} */


/* .case.pass   .casename{
    color: #329132 ;
} */
.case.pass   .caselabel{
    color: white;
    background-color: #3b9e3f;
}
/* .case.fail   .casename{
    color: #a64747;
} */
.case.fail   .caselabel{
    color: white;
    background-color: #a64747;
}
/* .case.abort   .casename{
    color: #953ab7;
} */
.case.abort   .caselabel{
    color: white;
    background-color: #9c27b0;
}



.case_step  {
    margin: .8em;
}
.checkpoint_pass {
    margin: .8em;
}
.checkpoint_fail {
    margin: .8em;
}

.case_step  .tag{
    color: #2196f3;;
    margin: .3em 1em .3em 0;
    padding: .1em .3em;
    font-size: .92em;
}

.checkpoint_pass .tag{
    color: #009806;
    margin:.3em 1em .3em .5em;
    padding: .1em .3em;
    font-size: .92em;
}
.checkpoint_fail .tag{
    color: #9c2020;
    margin:.3em 1em .3em .5em;
    padding: .1em .3em;
    font-size: .92em;
}

.screenshot {
    border: 1px solid #86c2dd;
}

.executetime {
    float: right;
}</style>
    <script type="text/javascript">var FOLDER_ALL_CASES = false //是否为精简模式的标记
var ERROR_INFOS = [];  // 错误信息列表
var current_error_idx = -1;

// 页面加载后执行的函数
window.addEventListener("load", function(){
    // 所有 .folder_header 添加点击事件处理
    let folderHeaderEles = document.querySelectorAll(".folder_header");
    folderHeaderEles.forEach(function(ele) {
        ele.addEventListener("click", function(event) {
        let fb = event.target.closest('.folder_header').nextElementSibling;
        fb.style.display = fb.style.display === 'none' ? 'block' : 'none'
        });
    });

    // 找到所有的错误信息对象
    ERROR_INFOS = document.querySelectorAll(".error-info");
});



function toggle_folder_all_cases(){
    let eles = document.querySelectorAll(".folder_body");
    
    FOLDER_ALL_CASES = !FOLDER_ALL_CASES;
    document.getElementById('display_mode').innerHTML = FOLDER_ALL_CASES? "Detail" : "Summary"

    for (const ele of eles){
        ele.style.display =  FOLDER_ALL_CASES? "none": "block"
    }
    
}



function previous_error(){
    // 查找错误必须是详细模式
    if (FOLDER_ALL_CASES)
        toggle_folder_all_cases()

    current_error_idx -= 1; 
    if (current_error_idx<0)
        current_error_idx = 0

    
    let error = ERROR_INFOS[current_error_idx];

    error.scrollIntoView({behavior: "smooth", block: "center", inline: "start"});

    
}


function next_error(){
    
    // 查找错误必须是详细模式
    if (FOLDER_ALL_CASES)
        toggle_folder_all_cases()

    current_error_idx += 1;
    if (current_error_idx > ERROR_INFOS.length-1)
        current_error_idx = ERROR_INFOS.length-1

    let error = ERROR_INFOS[current_error_idx];

    error.scrollIntoView({behavior: "smooth", block: "center", inline: "start"});
    
}</script>
  </head>
  <body>
    <div class="main_section">
      <h1 style="font-family: auto">Test Report - hytest v0.8.3</h1>
      <h3>Test Statistics</h3>
      <div class="result">
        <table class="result_table">
          <tbody>
            <tr>
              <td>Test Start Time</td>
              <td>20230902 08:43:06</td>
            </tr>
            <tr>
              <td>Test End Time</td>
              <td>20230902 08:43:06</td>
            </tr>
            <tr>
              <td>Duration Of Testing</td>
              <td>0.137Seconds</td>
            </tr>
            <tr>
              <td>number of cases to run</td>
              <td>6</td>
            </tr>
            <tr>
              <td>number of cases actually run</td>
              <td>6</td>
            </tr>
            <tr>
              <td>passed</td>
              <td>5</td>
            </tr>
            <tr>
              <td>failed</td>
              <td style="color:red">1</td>
            </tr>
            <tr>
              <td>exception aborted</td>
              <td style="">0</td>
            </tr>
            <tr>
              <td>blocked</td>
              <td style="">0</td>
            </tr>
            <tr>
              <td>suite setup failed</td>
              <td style="">0</td>
            </tr>
            <tr>
              <td>suite teardown failed</td>
              <td style="">0</td>
            </tr>
            <tr>
              <td>cases setup failed</td>
              <td style="">0</td>
            </tr>
            <tr>
              <td>cases teardown failed</td>
              <td style="">0</td>
            </tr>
          </tbody>
        </table>
        <div class="result_barchart">
          <div class="barchar_item">
            <span>cases passed 83.33% ： 5 </span>
            <div class="barchart_barbox">
              <div class="barchart_bar" style="width: 83.33%; background-color: #04AA6D;">83.33%</div>
            </div>
          </div>
          <div class="barchar_item">
            <span>cases failed 16.67% ： 1 </span>
            <div class="barchart_barbox">
              <div class="barchart_bar" style="width: 16.67%; background-color: #bb4069;">16.67%</div>
            </div>
          </div>
          <div class="barchar_item">
            <span>cases exception aborted 0% ： 0 </span>
            <div class="barchart_barbox">
              <div class="barchart_bar" style="width: 0.0%; background-color: #9c27b0;">0.0%</div>
            </div>
          </div>
          <div class="barchar_item">
            <span>cases blocked 0% ： 0 </span>
            <div class="barchart_barbox">
              <div class="barchart_bar" style="width: 0.0%; background-color: #dcbdbd;">0.0%</div>
            </div>
          </div>
        </div>
      </div>
      <div style="margin-top:2em">
        <h3 style="display:inline">Test Log</h3>
      </div>
      <div class="exec_log">
        <div class="suite_file" id="suite_file cases\1_login.py">
          <div>
            <span class="label">Enter File</span>
            <span>cases\1_login.py</span>
          </div>
          <div class="case pass" id="case_00000001">
            <div class="folder_header">
              <span class="label caselabel">Case PASS</span>
              <span class="casename">登录-api-1</span>
              <span class="executetime">2023-09-02 08:43:06</span>
            </div>
            <div class="folder_body">
              <span class="case_class_path">cases\1_login.py::c1</span>
              <div class="test_steps" id="test_steps 登录-api-1">
                <span class="label">Test Steps</span>
                <div class="info">{'msg': '用户名或者密码错误', 'ret': 1}</div>
                <div class="checkpoint_pass">
                  <span class="tag">CheckPoint PASS</span>
                  <span>返回一致</span>
                </div>
              </div>
            </div>
          </div>
          <div class="case pass" id="case_00000002">
            <div class="folder_header">
              <span class="label caselabel">Case PASS</span>
              <span class="casename">登录-api-2</span>
              <span class="executetime">2023-09-02 08:43:06</span>
            </div>
            <div class="folder_body">
              <span class="case_class_path">cases\1_login.py::c2</span>
              <div class="test_steps" id="test_steps 登录-api-2">
                <span class="label">Test Steps</span>
                <div class="info">{'msg': '用户名或者密码错误', 'ret': 1}</div>
                <div class="checkpoint_pass">
                  <span class="tag">CheckPoint PASS</span>
                  <span>返回一致</span>
                </div>
              </div>
            </div>
          </div>
          <div class="case pass" id="case_00000003">
            <div class="folder_header">
              <span class="label caselabel">Case PASS</span>
              <span class="casename">登录-api-3</span>
              <span class="executetime">2023-09-02 08:43:06</span>
            </div>
            <div class="folder_body">
              <span class="case_class_path">cases\1_login.py::c3</span>
              <div class="test_steps" id="test_steps 登录-api-3">
                <span class="label">Test Steps</span>
                <div class="info">{'msg': '用户名或者密码错误', 'ret': 1}</div>
                <div class="checkpoint_pass">
                  <span class="tag">CheckPoint PASS</span>
                  <span>返回一致</span>
                </div>
              </div>
            </div>
          </div>
          <div class="case pass" id="case_00000004">
            <div class="folder_header">
              <span class="label caselabel">Case PASS</span>
              <span class="casename">登录-api-4</span>
              <span class="executetime">2023-09-02 08:43:06</span>
            </div>
            <div class="folder_body">
              <span class="case_class_path">cases\1_login.py::c4</span>
              <div class="test_steps" id="test_steps 登录-api-4">
                <span class="label">Test Steps</span>
                <div class="info">{'msg': '用户名或者密码错误', 'ret': 1}</div>
                <div class="checkpoint_pass">
                  <span class="tag">CheckPoint PASS</span>
                  <span>返回一致</span>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="suite_file" id="suite_file cases\2_customer.py">
          <div>
            <span class="label">Enter File</span>
            <span>cases\2_customer.py</span>
          </div>
          <div class="case pass" id="case_00000005">
            <div class="folder_header">
              <span class="label caselabel">Case PASS</span>
              <span class="casename">客户-api-01</span>
              <span class="executetime">2023-09-02 08:43:06</span>
            </div>
            <div class="folder_body">
              <span class="case_class_path">cases\2_customer.py::c1</span>
              <div class="case_setup setup case_st_lable" id="case_setup setup 客户-api-01">
                <span class="label">Case Setup</span>
              </div>
              <div class="test_steps" id="test_steps 客户-api-01">
                <span class="label">Test Steps</span>
                <div class="case_step">
                  <span class="tag">Step #1</span>
                  <span>增加客户</span>
                </div>
                <div class="info">增加客户生成的id：99</div>
                <div class="case_step">
                  <span class="tag">Step #2</span>
                  <span>修改客户</span>
                </div>
                <div class="case_step">
                  <span class="tag">Step #3</span>
                  <span>查看客户</span>
                </div>
                <div class="info">响应报文：{'ret': 0, 'retlist': [{'address': '北京市大木仓胡同', 'id': 99, 'name': '北京市协和医院', 'phonenumber': '15185877883'}], 'total': 1}</div>
                <div class="checkpoint_pass">
                  <span class="tag">CheckPoint PASS</span>
                  <span>id一致且状态码正确</span>
                </div>
              </div>
              <div class="case_teardown teardown case_st_lable" id="case_teardown teardown 客户-api-01">
                <span class="label">Case Teardown</span>
              </div>
            </div>
          </div>
          <div class="case fail" id="case_00000006">
            <div class="folder_header">
              <span class="label caselabel">Case FAIL</span>
              <span class="casename">客户-api-2</span>
              <span class="executetime">2023-09-02 08:43:06</span>
            </div>
            <div class="folder_body">
              <span class="case_class_path">cases\2_customer.py::c2</span>
              <div class="case_setup setup case_st_lable" id="case_setup setup 客户-api-2">
                <span class="label">Case Setup</span>
              </div>
              <div class="test_steps" id="test_steps 客户-api-2">
                <span class="label">Test Steps</span>
                <div class="info">{'ret': 0}</div>
                <div class="checkpoint_fail">
                  <span class="tag">CheckPoint FAIL</span>
                  <span>返回一致</span>
                </div>
                <div class="info error-info"> 
Traceback:
  File &quot;D:\apiAutoTest\cases\2_customer.py&quot;, line 54, in teststeps
    CHECK_POINT(&quot;返回一致&quot;, expected == response)</div>
              </div>
              <div class="case_teardown teardown case_st_lable" id="case_teardown teardown 客户-api-2">
                <span class="label">Case Teardown</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div id="float_menu">
      <div class="menu-item" onclick="document.querySelector(&quot;body&quot;).scrollIntoView()">Home</div>
      <div class="menu-item" onclick="window.open(&quot;&quot;, &quot;_blank&quot;); ">Help</div>
      <div class="menu-item" id="display_mode" onclick="toggle_folder_all_cases()">Summary</div>
      <div class="error_jumper" display="block">
        <div class="menu-item" onclick="previous_error()" title="上一个错误">∧</div>
        <div class="menu-item" onclick="next_error()" title="下一个错误">∨</div>
      </div>
    </div>
  </body>
</html>